<?php
/**
 *
 *
 * @author Zeon <scplay@gmail.com>
 * @date 2018/7/12
 * @copyright PanxSoft Inc.
 */
namespace App\Services\Repositories;


use App\Models\Admin\StoreAdmin;
use App\Models\Customer\Customer;

class StoreAdminRepository
{
    protected $storeAdmin;

    public function __construct()
    {
        $this->storeAdmin = new StoreAdmin;
    }

    /**
     * 解除客户下所有店铺的店员的微信绑定
     * @test
     *
     * @param Customer $customer
     *
     * @return bool
     */
    public function resetCustomerStoreAdminsWechatUserBinding(Customer $customer): bool
    {
        return $this->storeAdmin
            ->whereIn('store_id', $customer->getStoreIds())
            ->update(['wechat_user_id' => 0]);
    }
}